package com.example.common.security.expression;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;
import java.util.Set;

/**
 * @program: springsecurity-study
 * @description:
 * @author: ChenZhiXiang
 * @create: 2019-08-01 16:23
 **/
@Component
public class MyAuthorizeConfigManger implements AuthorizeConfigManger {

    @Autowired
    private Set<AuthorizeConfigProvider> authorizeConfigProviders;

    @Override
    public void config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        for (AuthorizeConfigProvider authorizeConfigProvider : authorizeConfigProviders){
            authorizeConfigProvider.config(config);
        }
//        config.anyRequest().authenticated();
    }
}
